package calculator.operator.sp;


import calculator.operator.Operator;
import calculator.operator.Priority;

import java.math.RoundingMode;
import java.util.Stack;

public class CosOperator implements Operator {

    public double doCal(double num){
        return fix(Math.cos(Math.toRadians(num))).setScale(10, RoundingMode.HALF_UP).doubleValue();
    }

    @Override
    public double doCal(Stack<Double> stack) {
        return doCal(stack.pop());
    }

    @Override
    public int getPriority() {
        return Priority.PRIORITY_HIGHER + 1;
    }

    @Override
    public boolean support(char c) {
        return c == 'c';
    }

}
